<?php
/**
 * @version $Id: Noname.php 197 2008-03-01 17:23:36Z mikhail.miguel $
 * @author  Takeshi Kuriyama <kuri@keynext.co.jp>
 */

/**
 * Load PEAR error handling
 */
require_once 'PEAR.php';

/**
 * Load SpamCheck base class
 */

require_once dirname(dirname(dirname(dirname(__FILE__)))).'/Services/Trackback/SpamCheck.php';

class Services_Trackback_SpamCheck_Noname extends Services_Trackback_SpamCheck {
    var $_options = array(
        'continuous'    => false,
        'elements'      => array(
            'title',
//            'excerpt',
            'blog_name'
        ),
        'minmatches'    => 1
    );

    function Services_Trackback_SpamCheck_Noname($options = null)
    {
        if (is_array($options)) {
            foreach ($options as $key => $val) {
                $this->_options[$key] = $val;
            }
        }
    }

    // }}}
    // {{{ check()

    function check($trackback)
    {
        return $this->_checkSource($trackback);
    }

    // }}}
    // {{{ _checkSource()

    function _checkSource($trackback)
    {
        foreach($this->_options['elements'] as $element) {
            $input = $trackback->get($element);
            if(!empty($input)) return false;
        }
        return true;
    }

}